home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-10-04 | 17.0 KB | 413 lines |
- 'Total Domination Source Code
- '
- 'The Placement of buildings
- '
- 'In this part we shall take a look at the procedures that control
- 'placement of the buildings, in many ways when I look back at this
- 'code I find that there are many things that could have been shortened
-
-
- Procedure PLACECASTLE[_PLAYER,_COST]
-
- 'For each building procedure the program needs to know who is going to
- 'own that building _PLAYER and how much money will be needed _COST
-
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE NEW CASTLE - Select where to place"
- Wait 50 : Cls 0
-
- 'Using the message screen at the top of the screen the player is
- 'informed that they are going to be placing a Castle
-
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
-
- 'This short program loop is used to display the map coordinates on the
- 'message screen and to make sure that the player wants to go ahead
- 'The right mouse button allows the player to quit the operation
- 'whereas the left button sends the program to the procedure
- 'MZONETOMAPCOORD[MZ] which is used to convert a screen zone number
- 'into a x,y position value, the the program is sent to the label HERE
-
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- 'This line makes sure that the player doesn't place the building on a
- 'square that they can not even see, simply by using a Point command
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
-
- 'Then the program checks to make sure that the player has enough money...
-
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
-
- 'and finally if the square isn't already occupied.
-
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=12
- OWN(SX,SY)=_PLAYER+1
-
- 'If all this is ok then the program is told to place a construction icon on
- 'the square and then redraw the map. Once redrawn the correct icon
- 'is given to the map data and the ownership of the building is set.
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
-
- 'The relevent funds are taken care of and finally...
-
- Add CASTLE(_PLAYER),1 : Add _MAXSTORE(_PLAYER),20
-
- 'One is added to the castle variable and a MAXSTORE variable is increased by 20
- 'This line of code will be different for every building
-
- CONS=1
-
- 'The program is then informed that a construction has been made
-
- Wait 10 : Inc BUILDING
-
- 'And then the variable of BUILDING is increased so that the player
- 'can not build more than the number of men they have.
-
- Screen 2 : Cls 0
-
- End Proc
-
- Procedure PLACEWATCH[_PLAYER,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE WATCH TOWER - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
-
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=13
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- CONS=1
-
- Wait 10 : Inc BUILDING
- Screen 2 : Cls 0
- End Proc
- Procedure PLACESSETTLER[_PLAYER,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE SMALL SETTLEMENT - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
-
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Key=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=14
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add _MAXSETTLERS(_PLAYER),10
- Wait 10 : Inc BUILDING
- Screen 2 : Cls 0
- CONS=1
-
- End Proc
- Procedure PLACECSETTLER[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE SETTLEMENT CLUSTER - Select where to place"
- Wait 50 : Cls 0
- Do
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=15
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add _MAXSETTLERS(_PLAYER),25
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc
- Procedure PLACEWALL[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE CITY WALL - Select where to place "
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=5
- OWN(SX,SY)=3
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
-
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc
- Procedure PLACEBARRACKS[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE ARMY BARRACKS - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=18
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add _BARRACKS(_PLAYER),1
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc
- Procedure PLACELAB[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE SCIENCE LABORATORY - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=19
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add LABS(_PLAYER),1
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc
- Procedure PLACEWOODMILL[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE WOOD MILL - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=20
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add WOODCUT(_PLAYER),1
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc
- Procedure PLACEMINE[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE MINERAL MINE - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=21
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add COALMINE(_PLAYER),1
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc
- Procedure PLACEBLACK[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE BLACKSMITH - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=22
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add BLACKSMITH(_PLAYER),1
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc
- Procedure PLACEFOODFINDER[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE FOOD FINDER - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=23
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add FOODFINDER(_PLAYER),1
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc
- Procedure PLACESTORE[PL,_COST]
- Screen 2 : Pen 1 : Paper 0
- Cls 0
- Text 12,8,"PLACE STORE - Select where to place"
- Wait 50 : Cls 0
- Do
- If Mouse Click=2 Then Pop Proc
- Screen 2 : Ink 1,0
- Text 12,8,"Coordinates : "+Str$(MZ)+" "
- Screen 0 : MZ=Mouse Zone
- If Mouse Key=2 Then Pop Proc
- If Mouse Click=1 : Screen 0 : MZONETOMAPCOORD[MZ] : Goto HERE : End If
- If Mouse Click=2 Then Pop Proc
- Loop
- HERE:
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))=31 : Screen 2 : Cls 0 : Text 12,8,"No Within Sight" : Wait 50 : Cls 0 : Pop Proc : End If
-
- If Point(X Screen(X Mouse),Y Screen(Y Mouse))<>31 and MONEY(_PLAYER)<_COST Then Screen 2 : Cls 0 : Text 12,8,"Not enough funds" : Wait 100 : Pop Proc
- If MAP(STX(_PLAYER),STY(_PLAYER))>1 Then Screen 2 : Cls 0 : Text 12,8,"You cannot build here" : Wait 50 : Pop Proc
- SX=STX(_PLAYER) : SY=STY(_PLAYER)
- MAP(SX,SY)=42 : Screen 2 : Cls 0 : Text 12,8,"Please Wait Updating..." : Screen Hide 0 : SIGHT : Get Icon Palette : Screen 2 : Cls 0 : Screen Show 0
- MAP(SX,SY)=17
- OWN(SX,SY)=_PLAYER+1
-
- MONEY(_PLAYER)=MONEY(_PLAYER)-_COST
- Add STORES(_PLAYER),1 : Add _MAXSTORE(_PLAYER),50
- Wait 10 : Inc BUILDING
- CONS=1
- Screen 2 : Cls 0
- End Proc